package com.sky.course.controller;

import com.sky.course.entity.Course;
import com.sky.course.service.CourseClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
@RequestMapping(value = "/consumer")
public class CourseController_Consumer {

    @Autowired
    private CourseClientService client;

    @RequestMapping(value = "/course/get/{cid}")
    public Course get(@PathVariable("cid")Integer cid){
        return client.get(cid);
    }

    @RequestMapping(value = "/course/add")
    public Object add(Course course){
        return this.client.add(course);
    }

    @RequestMapping(value = "/course/list")
    public List<Course> list(){
        return client.list();
    }

}
